<?php


if (!defined("EXPONENT")) exit("");
	$listing = null;
	if (isset($_GET['id'])) {
		$listing = $db->selectObject("album","id=".$_GET['id']);
		if ($listing != null) {
			$loc = unserialize($listing->location_data);
		} 
	}
	
	if (exponent_permissions_check("manage",$loc)) {
		$config = $db->selectObject('albummodule_config',"location_data='".serialize($loc)."'");
		if ($config == null) {
			$config->item_per_page=10;
			$config->demo_collection=0;		 	 	 	 	 	 	 
 	    $config->hquality_collection=0;		 	 	 	 	 	 	 
 	    $config->track_collection=0;		 	 	 	 	 	 	 
 	    $config->sheet_collection=0;		 	 	 	 	 	 	 
 	    $config->tongpho_collection=0;		 	 	 	 	 	 	 
 	    $config->album_type=0;
 	    $config->album_collection=0;
		}
    $form = album::form($listing, $config);
		$form->location($loc);
		$form->meta("action","save");
				
		$template = new template("albummodule","_form_edit",$loc);
		$template->assign("is_edit",(isset($listing->id) ? 1 : 0));
		$template->assign("form_html",$form->toHTML());
		$template->output();
	} else {
		echo SITE_403_HTML;
	}

?>
